{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d91f4f4a",
   "metadata": {},
   "source": [
    "## 上周回顾\n",
    ">* 1. list的一般方法/函数的使用及案例，如：\n",
    ">> 1. append（）增加，增加list元素到list的末尾，常用与新建列表\n",
    ">> 2. pop（index）/remove（values）对比两者的区别和优势\n",
    ">> 3. count() 查看某个元素出现的次数\n",
    ">> 4. index（）查看某个元素第一次出现的位置\n",
    ">> 5. extend（）两个list合并在一起，也可以[]+[]\n",
    ">> 6.\n",
    ">* 2. list的高级用法，如：\n",
    ">> 1.copy（） list（可变的数据类型）复制 不等价于 赋值，可用[:]切片来实现\n",
    ">> 2.enumerate（）枚举，可同时 遍历并获取index和values\n",
    "\n",
    "## 本周内容（week08）\n",
    "### list练习，vowels.py vowels2.py\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cbb5322e",
   "metadata": {},
   "source": [
    ">* vowels.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9a74da2b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "# vowels = ['a','e','i','o','u']\n",
    "# word = \"Milliways\"\n",
    "# 检查 word中出现的元音，并打印出来怎么做\n",
    "# for letter in word:     # 第一个元素letter 请不要和已有变量重名\n",
    "                        # 第一个元素一般不定义名字，常用item（一般用i）来命名\n",
    "                        # 第二个元素word（重要），意味者将遍历内容\n",
    "                        # 遍历的内容一般是 序列数据 str list\n",
    "# for i in word:\n",
    "#     if i in vowels:\n",
    "#         print(i)\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "75cf57df",
   "metadata": {},
   "source": [
    ">* vowels2.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c9aef394",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 使用append（）新建列表\n",
    "# found = []\n",
    "# for i in word:\n",
    "#     if i in vowels:                       #在元音字母表中\n",
    "#         if i not in found:                 #不在元音字母表中\n",
    "#             found.append(letter)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c73f7bf",
   "metadata": {},
   "source": [
    ">* list实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2631eb90",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入你的支付宝余额:30000\n",
      " [('iphone13', 5600), ('macbook', 13000), ('ipad pro', 9800)]\n"
     ]
    }
   ],
   "source": [
    "goods_list = [('iphone13',5600),('macbook',13000),('ipad pro',9800)]\n",
    "shopping_list = [] #存放用户购买的商品\n",
    "user_salary = input(\"请输入你的支付宝余额:\")\n",
    "goods_list_源文件= goods_list.copy()\n",
    "print(\"打印商品信息\",goods_list)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ae973f61",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
